﻿using SqlSugar;

namespace Magic.Core;

/// <summary>
/// 菜单和权限规则表
///</summary>
[SugarTable("sys_menu")]
public class SysMenu
{
    /// <summary>
    /// ID 
    ///</summary>
    [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)]
    public int Id { get; set; }
    /// <summary>
    /// 上级菜单 
    /// 默认值: 0
    ///</summary>
    [SugarColumn(ColumnName = "pid")]
    public int? Pid { get; set; }
    /// <summary>
    /// 类型:menu_dir=菜单目录,menu=菜单项,button=页面按钮 
    /// 默认值: menu
    ///</summary>
    [SugarColumn(ColumnName = "type")]
    public string Type { get; set; }
    /// <summary>
    /// 标题 
    /// 默认值: 
    ///</summary>
    [SugarColumn(ColumnName = "title")]
    public string Title { get; set; }
    /// <summary>
    /// 规则名称 
    /// 默认值: 
    ///</summary>
    [SugarColumn(ColumnName = "name")]
    public string Name { get; set; }
    /// <summary>
    /// 路由路径 
    /// 默认值: 
    ///</summary>
    [SugarColumn(ColumnName = "path")]
    public string Path { get; set; }
    /// <summary>
    /// 图标 
    /// 默认值: 
    ///</summary>
    [SugarColumn(ColumnName = "icon")]
    public string Icon { get; set; }
    /// <summary>
    /// 菜单类型:tab=选项卡,link=链接,iframe=Iframe 
    ///</summary>
    [SugarColumn(ColumnName = "menu_type")]
    public string? Menu_type { get; set; }
    /// <summary>
    /// Url 
    /// 默认值: 
    ///</summary>
    [SugarColumn(ColumnName = "url")]
    public string? Url { get; set; }
    /// <summary>
    /// 组件路径 
    /// 默认值: 
    ///</summary>
    [SugarColumn(ColumnName = "component")]
    public string Component { get; set; }
    /// <summary>
    /// 缓存:0=关闭,1=开启 
    /// 默认值: 0
    ///</summary>
    [SugarColumn(ColumnName = "keepalive")]
    public byte? Keepalive { get; set; }
    /// <summary>
    /// 扩展属性:none=无,add_rules_only=只添加为路由,add_menu_only=只添加为菜单 
    /// 默认值: none
    ///</summary>
    [SugarColumn(ColumnName = "extend")]
    public string? Extend { get; set; }
    /// <summary>
    /// 备注 
    /// 默认值: 
    ///</summary>
    [SugarColumn(ColumnName = "remark")]
    public string? Remark { get; set; }
    /// <summary>
    /// 权重(排序) 
    /// 默认值: 0
    ///</summary>
    [SugarColumn(ColumnName = "weigh")]
    public int? Weigh { get; set; }
    /// <summary>
    /// 状态:0=禁用,1=启用 
    /// 默认值: 1
    ///</summary>
    [SugarColumn(ColumnName = "status")]
    public string Status { get; set; }
    /// <summary>
    /// 更新时间 
    ///</summary>
    [SugarColumn(ColumnName = "updatetime")]
    public int? Updatetime { get; set; }
    /// <summary>
    /// 创建时间 
    ///</summary>
    [SugarColumn(ColumnName = "createtime")]
    public int? Createtime { get; set; }

    /// <summary>
    /// 排序
    /// </summary>
    [SugarColumn(ColumnName = "sort")]
    public int Sort {  get; set; }


    [SugarColumn(IsIgnore =true)]
    public List<SysMenu> Children { get; set; }
}
